#include "TestWrapper.h"

// implementation code of WrapperFactory - do NOT modify the next 5 lines
AbstractWrapper* WrapperFactory::wrapper = 0;
AbstractWrapper* WrapperFactory::createWrapper() {
  if (wrapper == 0) wrapper = new TestWrapper;
  return wrapper;
}
// Do not modify the following line
volatile bool TestWrapper::GlobalStop = false;

// a default constructor
TestWrapper::TestWrapper() 
{
	pkb = new PKB();
	p = new Parser(pkb);
	de = new DesignExtractor(pkb);
	qe = new QueryEvaluator(pkb);
	qpp = new QueryPreProcessor(pkb);	
}

// method for parsing the SIMPLE source
void TestWrapper::parse(std::string filename) 
{
	p->startParsing(filename);
	de->extractDesign();
}

// method to evaluating a query
void TestWrapper::evaluate(std::string query, std::list<std::string>& results)
{
	vector<string> gaga = qe->evaluate(qpp->processQuery(query));
	for(int i = 0;i<(signed)gaga.size();i++)
	{
		results.push_back(gaga.at(i));
	}
}